#include"ThreadPool.hpp"
#include"Task.hpp"


int main()
{
    const string operators ="+/*/%";
    //unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>());
    unique_ptr<ThreadPool<Task>> tp(ThreadPool<Task>::getInstance());
    tp->start();
    srand((unsigned int)time(nullptr)^getpid()^pthread_self());
    while(true)
    {
        int one=rand()%50;
        int two=rand()%50;
        char oper=operators[rand()%operators.size()];
        Log()<<"主线程派发计算任务："<<one<<oper<<two<<"=?"<<endl;
        Task t(one,two,oper);
        tp->push(t);
        sleep(1);
    }
    
    //while(1);
    return 0;
}